package com.example.demo.framework.base;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BaseService {
	
	protected Logger log = LoggerFactory.getLogger(getClass());

	protected final static String SQL_COUNT = " COUNT(*) ";

	@PersistenceContext
	protected EntityManager em;

	protected Query createQuery(String hql, Object... values) {
		Query query = em.createQuery(hql);
		for (int i = 0; i < values.length; i++) {
			query.setParameter(i, values[i]);
		}
		return query;
	}

}
